﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace LibFriesland_Campina_CRM
{
    class DalStockCheckingDetail
    {
        //Them chi tiet phieu kiem kho
        public static int addStockCheckingDetail(BizStockCheckingDetail pStockCheckingDetail)
        {
            Friesland_Campina_CRM_DataContext db = new Friesland_Campina_CRM_DataContext(new MySqlConnection(Thuvien.getConnString()));
            try
            {
                StockCheckingDetail stockCheckingDetail = new StockCheckingDetail();
                stockCheckingDetail.ByStockCHeKing = pStockCheckingDetail.by_stock_checking;
                stockCheckingDetail.ByProduct = pStockCheckingDetail.by_product;
                stockCheckingDetail.ChangingQuantity = pStockCheckingDetail.changing_quantity;
                stockCheckingDetail.CurrentQuantity = pStockCheckingDetail.current_quantity;
                stockCheckingDetail.CommentChecking = pStockCheckingDetail.comment_checking;
                db.StockCheckingDetail.InsertOnSubmit(stockCheckingDetail);
                db.SubmitChanges();
                return 1;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
